<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                template="./resources/mastersPages/MasterPage.xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml">

    <ui:define name="content">
        <h:form>
                    <nav class="navbar navbar-default" role="navigation">
                        <ul class="nav navbar-nav">
                            <li class=""><a href="CadastrarInstituicao.xhtml"><i class="glyphicon glyphicon-plus"></i>  Novo instituição</a></li>
                        </ul>
                    </nav>

                </h:form>
        <h:form>

            <fieldset>
                <legend><i class="glyphicon glyphicon-th-list" ></i> Listagem</legend>
                <h:dataTable var="instituicao" value="#{instituicaoMB.instituicoes}" class="table table-bordered table-hover">
                    <h:column>
                        <f:facet name="header">
                            <h:commandLink value="ID" class="glyphicon glyphicon-sort"/>
                        </f:facet>
                        #{instituicao.idInstituicao}                    
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Nome Instituicao
                        </f:facet>
                        #{instituicao.nome}                    
                    </h:column>                
                    <h:column>
                        <f:facet name="header">
                            Descrição
                        </f:facet>
                        #{instituicao.cidade}                    
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            Status
                        </f:facet>
                        #{instituicao.statusString}   

                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Ações
                        </f:facet>
                        <h:commandLink action="#{instituicaoMB.editar(instituicao)}">
                            <i class="glyphicon glyphicon-pencil"></i>
                        </h:commandLink>


                        <h:commandLink action="#{instituicaoMB.excluir(instituicao)}" onclick="return confirm('Deseja realmente excluir?')">
                            <i class="glyphicon glyphicon-trash"></i>
                        </h:commandLink>                                          
                    </h:column>
                </h:dataTable>
            </fieldset>
        </h:form>

        <h:form>
            <h:commandLink action="Dashbord.xhtml" class="btn btn-link">Voltar</h:commandLink>
        </h:form>

    </ui:define>

</ui:composition>
